Loading the datasets
# Creating a vector of file pathes
file_pathes <- list.files(path = "G:\\My Drive\\Projects\\smokingandcaner\\datasets\\iarc", pattern = "*.csv", full.names = TRUE)
# Looping and importeing the datasets
for (i in 1:length(file_pathes)){
assign(paste0("dataset", i), read_csv(file_pathes[i]))
}
## Rows: 138 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Cancer label, Country label
## dbl (8): Cancer id, Population id, Sex, Type, Year, ASR (World), Crude rate,...
## lgl (1): Cumulative risk
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Rows: 134 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Cancer label, Country label
## dbl (8): Cancer id, Population id, Sex, Type, Year, ASR (World), Crude rate,...
## lgl (1): Cumulative risk
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Rows: 138 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Cancer label, Country label
## dbl (8): Cancer id, Population id, Sex, Type, Year, ASR (World), Crude rate,...
## lgl (1): Cumulative risk
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Rows: 134 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Cancer label, Country label
## dbl (8): Cancer id, Population id, Sex, Type, Year, ASR (World), Crude rate,...
## lgl (1): Cumulative risk
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Rows: 68 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Cancer label, Country label
## dbl (8): Cancer id, Population id, Sex, Type, Year, ASR (World), Crude rate,...
## lgl (1): Cumulative risk
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Rows: 110 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Cancer label, Country label
## dbl (8): Cancer id, Population id, Sex, Type, Year, ASR (World), Crude rate,...
## lgl (1): Cumulative risk
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Rows: 134 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Cancer label, Country label
## dbl (8): Cancer id, Population id, Sex, Type, Year, ASR (World), Crude rate,...
## lgl (1): Cumulative risk
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Rows: 136 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Cancer label, Country label
## dbl (8): Cancer id, Population id, Sex, Type, Year, ASR (World), Crude rate,...
## lgl (1): Cumulative risk
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# List all the datasets in the current working directory with a similar prefix
datasets <- ls(pattern="^dataset")
# Use lapply and rbind to combine the datasets into a single dataset
combined_data <- do.call(rbind, lapply(datasets, get))
combined_data <- combined_data %>% clean_names()